package com.haoma.controller;

import com.haoma.annotation.RequestCount;
import com.haoma.entity.AboutMe;
import com.haoma.entity.LearningPath;
import com.haoma.result.Result;
import com.haoma.service.AboutMeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Description:
 */
@RestController
@RequestMapping("/web/about")
@CrossOrigin
public class AboutMeController {

    @Autowired
    private AboutMeService aboutMeService;

    /**
     * 获取关于我的信息
     *
     * @return
     */
    @RequestCount
    @GetMapping()
    public Result getAboutMe() {
        AboutMe aboutMe = aboutMeService.getAboutMe();
        return Result.success(aboutMe);
    }

    /**
     * 获取学习路
     *
     * @return
     */
    @GetMapping("/path")
    public Result getLearningPath() {
        List<LearningPath> learningPathList = aboutMeService.getLearningPath();
        return Result.success(learningPathList);
    }
}
